package com.yunfeisoft.business.model;

import com.applet.base.ServiceModel;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * ClassName: PmsFeightTemplate
 * Description: 运费模版
 *
 * @Author: Jackie liu
 * Date: 2020-06-02
 */
@Entity
@Table(name = "PMS_FEIGHT_TEMPLATE")
public class PmsFeightTemplate extends ServiceModel implements Serializable {

    /**
     * Field serialVersionUID: 序列号
     */
    private static final long serialVersionUID = 1L;

    /**
     * 模版名称
     */
    @Column
    private String name;

    /**
     * 计费类型:0->按重量；1->按件数
     */
    @Column
    private Integer chargeType;

    /**
     * 首重kg
     */
    @Column
    private BigDecimal firstWeight;

    /**
     * 首费（元）
     */
    @Column
    private BigDecimal firstFee;

    /**
     * -
     */
    @Column
    private BigDecimal continueWeight;

    /**
     * -
     */
    @Column
    private BigDecimal continueFee;


    public String getChargeTypeStr() {
        return FeightTemplateChargeTypeEnum.valueOf(chargeType);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getChargeType() {
        return chargeType;
    }

    public void setChargeType(Integer chargeType) {
        this.chargeType = chargeType;
    }

    public BigDecimal getFirstWeight() {
        return firstWeight;
    }

    public void setFirstWeight(BigDecimal firstWeight) {
        this.firstWeight = firstWeight;
    }

    public BigDecimal getFirstFee() {
        return firstFee;
    }

    public void setFirstFee(BigDecimal firstFee) {
        this.firstFee = firstFee;
    }

    public BigDecimal getContinueWeight() {
        return continueWeight;
    }

    public void setContinueWeight(BigDecimal continueWeight) {
        this.continueWeight = continueWeight;
    }

    public BigDecimal getContinueFee() {
        return continueFee;
    }

    public void setContinueFee(BigDecimal continueFee) {
        this.continueFee = continueFee;
    }

    /**
     * 计费类型:0->按重量；1->按件数
     */
    public enum FeightTemplateChargeTypeEnum {

        WEIGHT(0, "按重量"),
        PIECE(1, "按件数");

        private int value;
        private String label;

        private FeightTemplateChargeTypeEnum(int value, String label) {
            this.value = value;
            this.label = label;
        }

        public static String valueOf(Integer value) {
            if (value == null) {
                return null;
            }
            for (FeightTemplateChargeTypeEnum loop : FeightTemplateChargeTypeEnum.values()) {
                if (value == loop.getValue()) {
                    return loop.getLabel();
                }
            }
            return null;
        }

        public int getValue() {
            return value;
        }

        public String getLabel() {
            return label;
        }
    }
}